package com.example.demo.controller;

import com.example.demo.common.Result;
import com.example.demo.dto.CheciAddDTO;
import com.example.demo.dto.CheciGetDTO;
import com.example.demo.service.CheciService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("api/v1/checi")
public class CheciController {
    @Autowired
    private CheciService checiService;

    @PostMapping
    public Result addCheci(@RequestBody CheciAddDTO checiAddDTO) {
        return checiService.addCheci(checiAddDTO);
    }

    @GetMapping
    public Result getCheci(CheciGetDTO checiGetDTO) {
        return checiService.getCheci(checiGetDTO);
    }

    @GetMapping("/getIds")
    public Result getIds() {
        return checiService.getCheciIds();
    }

    @PutMapping
    public Result updateCheci(@RequestBody CheciAddDTO checiAddDTO) {
        return checiService.updateCheci(checiAddDTO);
    }
}
